#include "widget.h"
#include "ui_widget.h"
#include <fstream>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    std::ifstream file("D:/2024C++/qt/QComboBox2/cf.txt");
    if(!file.is_open())
    {
        qDebug() << "fopen error";
        return;
    }

    std::string sline;
    while(std::getline(file,sline))
    {
        ui->comboBox->addItem(QString::fromStdString(sline));
    }
    file.close();
}

Widget::~Widget()
{
    delete ui;
}

